package cn.sciento.boot.transfer.infra.feign.fallback;

import feign.hystrix.FallbackFactory;
import cn.sciento.boot.transfer.infra.feign.HdttRemoteService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Component;

@Component
public class HdttRemoteServiceFactory implements FallbackFactory<HdttRemoteService> {
  private static final Logger logger = LoggerFactory.getLogger(HdttRemoteServiceFactory.class);
  
  private final HdttRemoteServiceImpl hdttRemoteServiceImpl;
  
  public HdttRemoteServiceFactory(HdttRemoteServiceImpl hdttRemoteServiceImpl) {
    this.hdttRemoteServiceImpl = hdttRemoteServiceImpl;
  }
  
  public HdttRemoteService create(Throwable throwable) {
    logger.error("do hdttRemoteService with error", throwable);
    return this.hdttRemoteServiceImpl;
  }
}
